package com.byx.chatclient.http;

import com.byx.chatclient.entity.Friend;
import com.byx.chatclient.entity.Result;
import com.byx.chatclient.entity.SimpleFriend;
import com.byx.chatclient.pojo.LoginDto;
import com.byx.chatclient.pojo.LoginVo;

import java.util.List;

import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Url;

/**
 * ApiUrl
 *
 * @author Superb
 * @date 2021/3/31 19:58
 */
public interface ApiUrl {
    @POST("/user/login")
    Call<Result<LoginDto>> login(@Body LoginVo loginVo);

    @POST("/user/getVerificationCodeForRegister")
    @FormUrlEncoded
    Call<Result<Boolean>> getVerificationCodeForRegister(@Field("number") String number,@Field("type") int type);

    @POST("/user/getVerificationCodeForLogin")
    @FormUrlEncoded
    Call<Result<Boolean>> getVerificationCodeForLogin(@Field("number") String number,@Field("type") int type);

    @POST("/user/getVerificationCodeForChangePwd")
    @FormUrlEncoded
    Call<Result<String>> getVerificationCodeForChangePwd(@Field("number") String number,@Field("type") int type);

    @POST("/user/checkVerificationCode")
    @FormUrlEncoded
    Call<Result<Boolean>> checkVerificationCode(@Field("number") String email,@Field("code") String code);

    @POST("/user/register")
    @FormUrlEncoded
    Call<Result<String>> register(@Field("number") String email,@Field("password") String password,@Field("timestamp") Long timestamp,@Field("registerWay") int registerWay);

    @POST("user/changePassword")
    @FormUrlEncoded
    Call<Result<Boolean>> changePassword(@Field("email") String email,@Field("password") String password);





    @Multipart
    @POST("/file/upload")
    Call<Result<String>> upload(@Part("userId") String userId, @Part MultipartBody.Part file, @Part("type") int type);

    @Multipart
    @POST("/file/uploadFiles")
    Call<Result> uploadFiles(@Part("userId") String userId, @Part List<MultipartBody.Part> files, @Part("type") int type);

    /**
     * 从服务器下载文件
     * @param url
     * @return
     */
    @GET
    Call<ResponseBody> download(@Url String url);
}
